package cn.iocoder.yudao.module.vehicle.dal.mysql.fuelcardapplication;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.vehicle.dal.dataobject.fuelcardapplication.FuelcardApplicationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.vehicle.controller.admin.fuelcardapplication.vo.*;

/**
 * 油卡申请记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface FuelcardApplicationMapper extends BaseMapperX<FuelcardApplicationDO> {

    default PageResult<FuelcardApplicationDO> selectPage(FuelcardApplicationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FuelcardApplicationDO>()
                .likeIfPresent(FuelcardApplicationDO::getProcessName, reqVO.getProcessName())
                .eqIfPresent(FuelcardApplicationDO::getProcessNumber, reqVO.getProcessNumber())
                .eqIfPresent(FuelcardApplicationDO::getApplicant, reqVO.getApplicant())
                .eqIfPresent(FuelcardApplicationDO::getApplicationUnit, reqVO.getApplicationUnit())
                .eqIfPresent(FuelcardApplicationDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .eqIfPresent(FuelcardApplicationDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(FuelcardApplicationDO::getCardNumber, reqVO.getCardNumber())
                .eqIfPresent(FuelcardApplicationDO::getVehicleId, reqVO.getVehicleId())
                .eqIfPresent(FuelcardApplicationDO::getRechargeAmount, reqVO.getRechargeAmount())
                .eqIfPresent(FuelcardApplicationDO::getApplicationStatus, reqVO.getApplicationStatus())
                .betweenIfPresent(FuelcardApplicationDO::getApplicationTime, reqVO.getApplicationTime())
                .betweenIfPresent(FuelcardApplicationDO::getCompletionTime, reqVO.getCompletionTime())
                .eqIfPresent(FuelcardApplicationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(FuelcardApplicationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FuelcardApplicationDO::getId));
    }

    default FuelcardApplicationDO selectByProcId(String id)
    {
        return selectOne(new LambdaQueryWrapperX<FuelcardApplicationDO>()
                .eq(FuelcardApplicationDO::getProcessInstanceId, id));
    }
            ;
}